package src.accenture.com.entity;

import java.io.Serializable;

import java.math.BigDecimal;

import java.util.Date;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedNativeQueries;
import javax.persistence.NamedNativeQuery;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@NamedQueries( { @NamedQuery(name = "MblEmployee.findAll", query = "select o from MblEmployee o") })
@Table(name = "MBL_EMPLOYEE")
@NamedNativeQueries( { @NamedNativeQuery(name = 
                                         "MblEmployee.checkLogin", 
                                         query = 
                                         "SELECT EMP_ID, EMP_FIRSTNAME, EMP_LASTNAME, GENDER, ROLE_ID \n" + 
                                         "	FROM  	MBL_EMPLOYEE \n" + 
                                         "	WHERE 	EMP_USERNAME = ?username \n" + 
                                         "		AND EMP_PASSWORD = ?password ", 
                                         resultClass = MblEmployee.class)
        } )
public class MblEmployee implements Serializable {
    @Column(name = "EMP_ADDRESS", length = 4000)
    private String empAddress;
    @Temporal(TemporalType.DATE)
    @Column(name = "EMP_BIRTHDAY")
    private Date empBirthday;
    @Column(name = "EMP_DESCRIBE", length = 4000)
    private String empDescribe;
    @Column(name = "EMP_FIRSTNAME", length = 4000)
    private String empFirstname;
    @Id
    @Column(name = "EMP_ID", nullable = false, length = 10)
    private String empId;
    @Column(name = "EMP_LASTNAME", length = 4000)
    private String empLastname;
    @Column(name = "EMP_PASSWORD", length = 4000)
    private String empPassword;
    @Column(name = "EMP_SALARY")
    private BigDecimal empSalary;
    @Column(name = "EMP_USERNAME", nullable = false, unique = true, length = 4000)
    private String empUsername;
    @Column(nullable = false)
    private int gender;
    @ManyToOne
    @JoinColumn(name = "DEP_ID")
    private MblDepartment mblDepartment;
    @OneToMany(mappedBy = "mblEmployee")
    private List<MblRegistration> mblRegistrationList;
    @OneToMany(mappedBy = "mblEmployee1")
    private List<MblRegistration> mblRegistrationList1;
    @ManyToOne
    @JoinColumn(name = "ROLE_ID")
    private MblRole mblRole;

    public MblEmployee() {
    }

    public MblEmployee(MblDepartment mblDepartment, String empAddress, Date empBirthday, String empDescribe,
                       String empFirstname, String empId, String empLastname, String empPassword, BigDecimal empSalary,
                       String empUsername, int gender, MblRole mblRole) {
        this.mblDepartment = mblDepartment;
        this.empAddress = empAddress;
        this.empBirthday = empBirthday;
        this.empDescribe = empDescribe;
        this.empFirstname = empFirstname;
        this.empId = empId;
        this.empLastname = empLastname;
        this.empPassword = empPassword;
        this.empSalary = empSalary;
        this.empUsername = empUsername;
        this.gender = gender;
        this.mblRole = mblRole;
    }

    public MblEmployee(String empId, String empFirstname, String empLastname, int gender) {
        this.empId = empId;
        this.empFirstname = empFirstname;
        this.empLastname = empLastname;
        this.gender = gender;
    }

    public String getEmpAddress() {
        return empAddress;
    }

    public void setEmpAddress(String empAddress) {
        this.empAddress = empAddress;
    }

    public Date getEmpBirthday() {
        return empBirthday;
    }

    public void setEmpBirthday(Date empBirthday) {
        this.empBirthday = empBirthday;
    }

    public String getEmpDescribe() {
        return empDescribe;
    }

    public void setEmpDescribe(String empDescribe) {
        this.empDescribe = empDescribe;
    }

    public String getEmpFirstname() {
        return empFirstname;
    }

    public void setEmpFirstname(String empFirstname) {
        this.empFirstname = empFirstname;
    }

    public String getEmpId() {
        return empId;
    }

    public void setEmpId(String empId) {
        this.empId = empId;
    }

    public String getEmpLastname() {
        return empLastname;
    }

    public void setEmpLastname(String empLastname) {
        this.empLastname = empLastname;
    }

    public String getEmpPassword() {
        return empPassword;
    }

    public void setEmpPassword(String empPassword) {
        this.empPassword = empPassword;
    }

    public BigDecimal getEmpSalary() {
        return empSalary;
    }

    public void setEmpSalary(BigDecimal empSalary) {
        this.empSalary = empSalary;
    }

    public String getEmpUsername() {
        return empUsername;
    }

    public void setEmpUsername(String empUsername) {
        this.empUsername = empUsername;
    }

    public int getGender() {
        return gender;
    }

    public void setGender(int gender) {
        this.gender = gender;
    }


    public MblDepartment getMblDepartment() {
        return mblDepartment;
    }

    public void setMblDepartment(MblDepartment mblDepartment) {
        this.mblDepartment = mblDepartment;
    }

    public List<MblRegistration> getMblRegistrationList() {
        return mblRegistrationList;
    }

    public void setMblRegistrationList(List<MblRegistration> mblRegistrationList) {
        this.mblRegistrationList = mblRegistrationList;
    }

    public MblRegistration addMblRegistration(MblRegistration mblRegistration) {
        getMblRegistrationList().add(mblRegistration);
        mblRegistration.setMblEmployee(this);
        return mblRegistration;
    }

    public MblRegistration removeMblRegistration(MblRegistration mblRegistration) {
        getMblRegistrationList().remove(mblRegistration);
        mblRegistration.setMblEmployee(null);
        return mblRegistration;
    }

    public List<MblRegistration> getMblRegistrationList1() {
        return mblRegistrationList1;
    }

    public void setMblRegistrationList1(List<MblRegistration> mblRegistrationList1) {
        this.mblRegistrationList1 = mblRegistrationList1;
    }

    public MblRole getMblRole() {
        return mblRole;
    }

    public void setMblRole(MblRole mblRole) {
        this.mblRole = mblRole;
    }
   
}
